-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove NodeId from Block and Expr #58698
Conversation
Oof, I forgot about the |
@@ -679,7 +678,7 @@ pub fn check_unsafety<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { | |||
} | |||
|
|||
let mut unsafe_blocks: Vec<_> = unsafe_blocks.into_iter().collect(); | |||
unsafe_blocks.sort(); | |||
unsafe_blocks.sort_by_cached_key(|(hir_id, _)| tcx.hir().hir_to_node_id(*hir_id)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's find to just use sort
here. Do you know which errors changed order with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, plain sort breaks 2 issue test cases related to unused unsafe (unfortunately I forgot to register which ones).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well we can land sort_by_cached_key
here and you could open a new PR with an additional commit which changes it back to sort
, so we can look at the failures.
@@ -425,8 +425,8 @@ impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> { | |||
} | |||
pprust_hir::AnnNode::Expr(expr) => { | |||
s.s.space()?; | |||
s.synth_comment(format!("node_id: {} hir local_id: {}", | |||
expr.id, expr.hir_id.local_id.as_u32()))?; | |||
s.synth_comment(format!("expr hir_id: {} hir local_id: {}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You added expr
here. Not sure if that's good or bad =P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, so that it matches the other branches; I mean, it shouldn't break anything ^^.
@@ -271,7 +271,8 @@ fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) | |||
return (ctor_vis, span, descr); | |||
} | |||
Node::Expr(expr) => { | |||
return (ty::Visibility::Restricted(tcx.hir().get_module_parent(expr.id)), | |||
return (ty::Visibility::Restricted( | |||
tcx.hir().get_module_parent_by_hir_id(expr.hir_id)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This formatting doesn't quite make sense to me =P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I was just trying to squeeze it so that tidy doesn't complain; I can adjust it if need be :P.
I've looked over this and it looks good. You can append it to #58561 |
@Zoxc done; what about that |
Oh, and closing in favor of #58561. |
@ljedrz That's probably due to padding. |
@Zoxc I ran tests with that plain
|
The next iteration of #57578. The relevant part is the last 2 commits (the others are dependencies).
Removes
NodeId
fromhir::Block
hir::Expr
Blocked by #58561, can be appended to it.
r? @Zoxc